// 简单的SQLite检索测试脚本
import { CodeSnippetsCodebaseIndex } from './src/core/codeSnippetsIndex.js';

async function testSQLiteQuery() {
  try {
    // 测试检索特定签名的代码片段
    const signatures = ['getDB', 'saveLancedb', 'searchLancedb'];
    
    for (const signature of signatures) {
      console.log(`\n查询签名为 "${signature}" 的代码片段:`);
      const results = await CodeSnippetsCodebaseIndex.getAll(signature);
      
      if (results && results.length > 0) {
        console.log(`找到 ${results.length} 个匹配结果:`);
        results.forEach((result, index) => {
          console.log(`\n结果 ${index + 1}:`);
          console.log(`标题: ${result.title}`);
          console.log(`路径: ${result.path}`);
          console.log(`ID: ${result.id}`);
        });
      } else {
        console.log('没有找到匹配的结果');
      }
    }
  } catch (error) {
    console.error("SQLite查询时出错:", error);
  }
}

testSQLiteQuery();